define(['app', 'assets/js/distpicker.min.js'],function(app){return {module: function($scope, $http, eventBusService, httpService, params) {


		//年级
		httpService.post(app.urls.grade_select,{fk_stage:"02030218-1e1c-4dc8-81f5-10e0ceb015a4"},function(data){
			if("0000" === data.code){
				$scope.gradeList = data.data;
			}else{
				alert(data.msg);
			}
		});



		//班级
		httpService.post(app.urls.class_select,$scope.form,function(data){
			if("0000" === data.code){
				$scope.classList = data.data;
			}else{
				alert(data.msg);
			}
		});

		//性别
		httpService.post(app.urls.dictionary_selectOne,{fk_rule:'SJAAAAA29'},function(data){
			if("0000" === data.code){
				$scope.sexList = data.data;
			}else{
				alert(data.msg);
			}
		});



		$scope.findMajor = function(){
			httpService.postpage(app.urls.major_select,$scope.form,function(data){
				if("0000" === data.code){
					$scope.majorList = data.data;
				}else{
					alert(data.msg);
				}
			});
		}


		$scope.findClass = function(){
			httpService.postpage(app.urls.class_select,$scope.form,function(data){
				if("0000" === data.code){
					$scope.classList = data.data;
				}else{
					alert(data.msg);
				}
			});
		}




		$scope.find = function(){
			httpService.postpage(app.urls.gradlist_selectForList,$scope.form,function(data){
				if("0000" === data.code){
					$scope.rows = data.data;
				}else{
					alert(data.msg);
				}
			});
		}


		$scope.save = function(){
			var values = [];
			$('input[name="dataPk"]:checked').each(function() {
				values.push($(this).val());
			});

			if(values.length < 1) {
				eventBusService.publish("modal.alert", {"content":"请选择一条数据。"});
			}else{

				for(var i=0;i<values.length;i++){

					$scope.form.fk_student = values[i]
					httpService.post(app.urls.gradlist_insert,$scope.form,function(data){
						if("0000" === data.code){
							eventBusService.publish("modal.alert", {"content": "提交成功"});
							eventBusService.publish("content.page.reload", data.data);
							eventBusService.publish("modal.page.close", {});
						}else{
							alert(data.msg);
						}
					});
				}
			}
		}




		//按钮点击事件-条件查询
		$scope.select = function(){
			$scope.page.current = 1;
			$scope.find();
		}


}}});